import { FormSchema, BasicColumn } from '/@/components/Table';
import { DescItem } from '/@/components/Description/index';
import { render } from '/@/utils/common/renderUtils';

export enum DataGroupBizType {
  // 素材管理
  MATERIAL = 1,
  // 字典管理
  DICT = 2,
  // 配置
  CONFIG = 3,
  // 消息推送功能组
  MSG_PUSH_TASK = 4,
  // 移动端菜单
  MOBILE_MENU = 5,
  // 数据集合
  DATASET = 6,
  // 在线表单设计
  DIY_FORM = 7,
  // 短链
  SHORT_LINK = 8,
}

export const columns : BasicColumn[] = [
  {
    title: '名称',
    dataIndex: 'name',
    width: 110,
    align: 'left'
  },
  {
    title: '排序',
    dataIndex: 'sortNo',
    width: 80,
  },
  {
    title: '编码',
    dataIndex: 'code',
    width: 120,
  },
  {
    title: '创建时间',
    dataIndex: 'createdAt',
    width: 150,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'name',
    label: '名称',
    component: 'Input',
  },
];


export const formSchema: FormSchema[] = [
  {
    label: 'id',
    field: 'id',
    component: 'Input',
    show: false
  },
  {
    label: 'isTree',
    field: 'isTree',
    component: 'RadioGroup',
    show: false
  },
  {
    field: 'name',
    label: '分组名称',
    component: 'Input',
    required: true,
  },
  {
    field: 'code',
    label: '组编码',
    component: 'Input',
    required: false,
  },
  {
    field: 'parentId',
    label: '上级分组',
    component: 'TreeSelect',
    required: false,
    ifShow: ({ model, field }) => model['isTree']
  },
  {
    field: 'sortNo',
    label: '排序',
    required: true,
    component: 'InputNumber',
    defaultValue: 1
  },
  {
    field: 'remark',
    label: '备注',
    component: 'InputTextArea',
    componentProps: {
      autoSize: {
        minRows: 3,
        maxRows: 8
      }
    }
  },
];

